<script type='text/javascript' src='{CPortal::$static_url}3rdparty/mediaplayer/swfobject.js'></script>
<textarea id="show-room-template{module()->id}" style="display:none">
	<div class="name">
		<h6 id="product-name<.=data.userId.>"><.=data.name.><.=data.quantity.></h6>
        <.if(SYS.vimuaChat.isSeller){.>
			<span id="lessProduct<.=data.userId.>">
			<.if(data.quantity<=3){.>
				<p><div style="clear:both;color:red;text-align: center;padding-left:15px;" title="Tư vấn viên cần confirm với Điều phối viên về việc còn hàng hay ko?"><Blink>Sắp hết hàng</Blink></div></p>
			<.}.>
			</span>
        <p>Giá min <strong ><span id="min-price<.=data.userId.>"><.=SYS.numberFormat(data.min_price*1000).></span> {currency}</strong> Giá max <strong><span id="price<.=data.userId.>"><.=SYS.numberFormat(data.price*1000).></span> {currency}</strong></p>
        <.}
		else
		{.>
        <p>Giá bán:<strong><span id="price<.=data.userId.>"><.=SYS.numberFormat(data.price*1000).></span> {currency}</strong></p>
        <.}.>
    </div>
	<div class="main">
		<img id="picture-tab<.=data.userId.>" src="<.=SYS.image(data.large).>" alt="" class="showroomDetail" />
		<div id="video-tab<.=data.userId.>" class="showroomDetail" style="display:none"></div>
		<div id="flash-tab<.=data.userId.>" class='showroomDetail' style="display:none"></div>
		<div id="properties-tab<.=data.userId.>" class='showroomDetail properties-tab' style="display:none;overflow:auto;"></div>
	</div>
	<div class="scroll">
		<ul>
			<li><a href="#a" title="Ảnh sản phẩm" onclick="SYS.vimuaChat.sendPicture('<.=SYS.image(data.large).>||<.=data.id.>');"><img src="<.=SYS.image(data.thumbnail).>" alt="Product Thumbnail" width="50" height="50" /><span class="photo"></span></a></li>
			<.for(var i in data.images){.>
			<li><a href="#a" title="Ảnh sản phẩm" onclick="SYS.vimuaChat.sendPicture('<.=SYS.image(data.images[i].large).>||<.=data.id.>');"><img src="<.=SYS.image(data.images[i].thumbnail).>" alt="Product Thumbnail" width="50" height="50" /><span class="photo"></span></a></li>
			<.}.>
			<.if(data.media){.>
			<li><a href="#a" title="Video sản phẩm" onclick="SYS.vimuaChat.sendVideo('<.=SYS.image(data.media).>||<.=data.id.>');"><img src="<.=SYS.image(data.thumbnail).>" alt="Video sản phẩm" width="50" height="50" /><span class="video"></span></a></li>
			<.}.>
			<.if(data.flash){.>
			<li><a href="#a" title="Xem 360" onclick="SYS.vimuaChat.sendFlash('<.=SYS.image(data.flash).>||<.=data.id.>');"><img src="<.=SYS.image(data.thumbnail).>" alt="Flash sản phẩm" width="50" height="50" /><span class="flash"></span></a></li>
			<.}.>
			<li><a href="#a" title="Thông số sản phẩm" onclick="SYS.vimuaChat.sendProperties('<.=data.id.>');"><img src="<.=SYS.image(data.thumbnail).>" alt="Đặc tính kỹ thuật" width="50" height="50" /><span class="info"></span></a></li>
		</ul>
	</div>
</textarea>
<script src="/ls/lscommons.js" type="text/javascript"></script>
<script src="/ls/lspushpage.js" type="text/javascript"></script>
<script src="/ls/VKMpacked.js" type="text/javascript"></script>
<div style="width:1px;height:1px;line-height:1px;">
	<div id="Bach"></div>
</div>
<div  style="display:none">
  <div class="messageContainer"  id="messages" source="lightstreamer" style="visibility: hidden;">
	<span class="messagePart1" source="lightstreamer" item="1" field="fromNick"></span><span class="messagePart1" style="margin-left: 5px">tới</span>
	<span class="messagePart1" source="lightstreamer" item="1" field="toNick"></span><span class="messagePart1" style="margin-left: 0px">:</span>
	<span class="messagePart2" source="lightstreamer" item="1" field="message"></span>
  </div>
</div>
<div id="vimuachat_holder" style="display:none;">
	<div id="vimuachat">
		<div class="toolbar">
			<!--IF(is_seller)-->
			<div class="left">
				<p>
					<input type="text" class="input_text1" value="Tìm nhanh"  name='keyword' disabled id="keyword{module()->id}"/>
					<input type="button" id="search{module()->id}" title="Tìm kiếm nhanh" value="Tìm kiếm nhanh" disabled class="input_button"  onclick="{jm()}.selFilter();"/>
				</p>
			</div>
		<!--/IF-->
			<div class="right">
				<ul>
					<li class="quickprice">
					<!--IF(is_seller)-->
						<span class="pieholder" id="price-table" style="z-index:111">
							<table cellspacing="0" cellpadding="0" summary="Bảng giá">
								<colgroup>
									<col width="95px;"></col>
									<col width="150px;"></col>
									<col width="auto"></col>
									<col width="20"></col>
								</colgroup>
								<tr>
									<td>Giá bán</td>
									<td class="price" align="right" colspan="2"><span id="price_{module()->id}"></span> {currency}</td>
									<td><a href="#a" onclick="SYS.vimuaChat.sendMessage('Giá bán(Bao gồm cả VAT) ' + $('#price_{module()->id}').text() + ' {currency}',SYS.Messenger.PRICE_TYPE);" title="Gửi cho người mua"><img src="{static_url}{module()->path}/+i/arrow_right.gif" alt="Gửi" /></a></td>
								</tr>
								<tr>
									<td>Phí vận chuyển</td>
									<td>
										<select onchange="SYS.vimuaChat.changeProvince($(this).val());" id='VMC-zone'>
										<!--LIST(zones)-->
										  	<!--IF(zones.id == 23)-->
												<option value="{zones.id}" selected="selected">{zones.name}</option>
											<!--/IF-->
											<!--IF(zones.id == 30)-->
												<option value="{zones.id}">{zones.name}</option>
											<!--/IF-->
										<!--/LIST-->
										<!--LIST(zones)-->
										  	<!--IF(zones.id != 23)-->
												<option value="{zones.id}">{zones.name}</option>
											<!--/IF-->
										<!--/LIST-->
										</select>
										
										<select style="margin-top:3px;" onchange="SYS.vimuaChat.updateProductPrice($(this).val());" id='VMC-district-select{module()->id}'>
											<option value="0">Chọn khu vực</option>
										 <!--LIST(districts)-->
										    	<!--IF(districts.province_id==23)-->
													<option value="{districts.id}">{districts.name}</option>
												<!--/IF-->
											<!--/LIST-->
										</select>
									</td>
									<td class="price"><span id="shipping_fee_{module()->id}"></span> {currency}</td>
									<td><a href="#a" onclick="SYS.vimuaChat.sendMessage('Phí vận chuyển đến '+ $('#VMC-zone option:selected').text()+'('+ $('#VMC-district-select{module()->id} option:selected').text() +') là ' + $('#shipping_fee_{module()->id}').text() + ' {currency}',SYS.Messenger.PRICE_TYPE);" title="Gửi cho người mua"><img src="{static_url}{module()->path}/+i/arrow_right.gif" alt="Gửi" /></a></td>
								</tr>
								<tr>
									<td>Được giảm giá </td>
									<td class="price" align="right" colspan="2"><span id="discount_value_{module()->id}"></span> {currency}</td>
									<td><a href="#a" onclick="SYS.vimuaChat.sendMessage('Bạn được giảm ' + $('#discount_value_{module()->id}').text() + ' {currency}',SYS.Messenger.PRICE_TYPE);" title="Gửi cho người mua"><img src="{static_url}{module()->path}/+i/arrow_right.gif" alt="Gửi" /></a></td>
								</tr>
								<tr>
									<td>Tổng tiền</td>
									<td class="price" align="right" colspan="2"><span id="amount_{module()->id}"></span> {currency}</td>
									<td><a href="#a" onclick="SYS.vimuaChat.sendMessage('Tổng số tiền bạn phải trả là ' + $('#amount_{module()->id}').text() + ' {currency}',SYS.Messenger.PRICE_TYPE);SYS.vimuaChat.sendPrice();" title="Gửi cho người mua"><img src="{static_url}{module()->path}/+i/arrow_right.gif" alt="Gửi" /></a></td>
								</tr>
							</table>
						</span>
						<input id="costInput{module()->id}" type="text" class="input_text" value="Tính giá" disabled/>
						<input type="submit" id="quick_price_eval" title="Tính giá nhanh"  onclick="$('#price-table table').toggle();SYS.vimuaChat.updateProductPrice();" value="Tính giá nhanh" class="input_button" />
						<a href="#a" onclick="SYS.vimuaChat.sendPrice();"title="Gửi cho người mua"><img src="{static_url}{module()->path}/+i/arrow_right.gif" alt="Gửi" /></a>
					</li>
					<!--/IF-->
					<li><a href="#a" onclick="SYS.vimuaChat.addFavourite();" <!--IF(!is_seller)--> title="Ưa thích người bán này" <!--ELSE-->title="Ưa thích người mua này"<!--/IF--> ><img src="{static_url}{module()->path}/+i/user_add.gif" alt="" /></a></li>
					<li><a class="link_button" onclick="SYS.vimuaChat.addWishlist();" title="Theo dõi sản phẩm này" href="#a"><img src="{static_url}{module()->path}/+i/thumb_up.gif" alt="" /></a></li>
					<li style="display:none;"><a class="link_button" onclick="SYS.vimuaChat.buy();"  title="Mua sản phẩm này" href="#a"><img src="{static_url}{module()->path}/+i/cart_put.png" alt="" /></a></li>
					<li class="last"><a href="#minimize" class="button_minimize" title="Thu nhỏ"><img src="{static_url}{module()->path}/+i/minus1.gif" alt="" /></a></li>
				</ul>
			</div>
			<div class="clrer"></div>
		</div>
		<div id="listSearchChat"></div>
		<div class="textbar">
			<div class="column1">Sản phẩm</div>
			<div class="column2">Chat</div>
			<div class="column3">
			<!--IF(is_seller)-->Danh sách người mua<!--ELSE-->Danh sách người bán<!--/IF--></div>
			<div class="clrer"></div>
		</div>
		<div class="container">
			<div class="column1" id="showroomArea" class="showroomArea">
				<div id="vimuachat-show" class="show-room">{banner}</div>
			</div>

			<div class="column2">
				<div id="tabs{module()->id}" class="messageArea">

					<div id="tabPane">
						<div id='VMC-system-panel' class="messagePanel" ></div>
					</div>
					 <div class="icon-chat">
						<a class="icon-chat" href="#a" onclick="{jm()}.showEmoticonDialog();void(0);"><img class="icon-chat" src="{static_url}{module()->path()}/+i/chat-icon-emo.gif" /></a>
						<a class="icon-chat" href="#a" onclick="SYS.vimuaChat.buzz();void(0);"><img class="icon-chat" src="{static_url}{module()->path()}/+i/chat-icon-buzz.gif" /></a>
					</div>
					<div class="message-chat-input">
						<form onSubmit="SYS.vimuaChat.sendMessage($('#user_message').val(),SYS.Messenger.MESSAGE_TYPE); return false;" style="margin-top: 3px;" >
						  <div>
							<input id="user_message" type="text"  />
							<input id="message_button" type="submit"  value="Gửi" class="input-button" />
						  </div>
						  <input type="hidden">
						</form>
					</div>
				</div>
			</div>
			<div class="column3">
				<div id="vimuachat_list">
					<ul class="usertab">
						<li><a href="#fav" <!--IF(is_seller)--> title="Người mua ưa thích"<!--ELSE--> title="Người bán ưa thích" <!--/IF--> >
						<img src="{static_url}{module()->path}/+i/star.gif" height="16px" width="16px" alt="" />
						</a>
						</li>
						<li class="current"><a href="#all">Đang chat</a></li>
					</ul>
					<div id="VMC-Buddy-Table" source="lightstreamer" style="display:none;">
							<div><a href="#a"> <div source="lightstreamer" field="key" class="buddy"></div></a></div>
					</div>
					<ul id="list-buddy" class="userlist list_all">
					</ul>

					<ul id="list-fav"class="userlist list_fav"  >
						<!--IF(count(friends)>0)-->
							<!--LIST(friends)-->
						<li id='VMC-fav-list-{friends.friend_id}'><a href="#a" class="gray" >{friends.friend_id}</a></li>
							<!--/LIST-->
						<!--/IF-->
					</ul>
				</div>
			</div>
			<div class="clrer"></div>
		</div>
		<div class="statusbar">
			<div style="padding:0px 0 0 7px;line-height:20px;" id="chat-connect-ttv-loadding">
			</div>
			<!--IF(is_seller)-->
				<div class="txtr">Doanh số: <strong>{CNumber(success_amount*1000)->price()}{currency}</strong> &nbsp; &nbsp; Hoa hồng <strong>{CNumber(seller_fee*1000)->price()}{currency}</strong></div>
			<!--/IF-->
		</div>
	</div>
	<div class="shadow"></div>
</div>
<div id="statusDiv" class="status" style="display:none">WAITING FOR ENGINE...</div>
<script type="text/javascript">
SYS.using({
	MAXIMUM_CHAT_ACCOUNTS: {constant('MAXIMUM_CHAT_ACCOUNTS')},
	custom_product_id:'{request('custom_product_id')}',
	userId:'{userId}',
	time:{time()},
	isDebug:'{request('debug')}',
	<!--IF(is_seller)-->	
	ver:'{ver}',
	<!--/IF-->
  <!--IF(!empty(friends))-->
	friendList:[
		<!--LIST(friends)-->
			<!--IF(friends._index!=1)-->,<!--/IF-->'{friends.friend_id}'
		<!--/LIST-->],
  <!--/IF-->
	isSeller: {is_seller},
	currency: '{currency}'
});
</script>